<?php
/*
 *后台日志管理
 *author 王建 
 */

class LogAction extends BaseAction{
    public $d = '';
    function __construct(){
        parent::__construct();
        $this->d = D("Admin/Log");;
    }
    function index(){
        $action = $this->_request("action");    
        $action_array = array("show","ajax_data");
        $action = !in_array($action,$action_array)?'show':$action ;
        if($action == 'show'){
            $table = $this->d->log_table();
  
            $this->assign("table" , $table);
            $this->display();
        }elseif($action == 'ajax_data'){
            $this->ajax_data();
        }
    }
    //ajax get data
    private function ajax_data(){
        $data = array();
        $page = intval($this->_request("page"));
        $data = array(
            'log_person'=>trim($this->_request('log_person' )) , 
            'log_url'=>trim($this->_request('log_url')) ,
            'status'=>$this->_request('status') ,
            'table'=>trim($this->_request('table')) ,
        );
        
        $list = $this->d->queryLogList($page ,50 ,  $data );
        echo result_to_towf_new($list['list'], 1, '成功', $list['page_sting']) ;
    }
 
}